﻿/*
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>

#include "icdbapi.h"

int main(void)
{
	int ret = 0;
	int bounds = 10;
	char* dbName = "orcl";
	char* dbUser = "SCOTT";
	char* dbPswd = "11";
	char mySql[2048] = { 0 };

	ICDBHandle handle = NULL;//void * -- ICDBHandle

	//初始化 数据库连接池
	ret = IC_DBApi_PoolInit(bounds, dbName, dbUser, dbPswd);
	if (ret != 0)
	{
		printf("func IC_DBApi_PoolInit() err:%d\n", ret);
		return ret;
	}

	ret = IC_DBApi_ConnGet(&handle, 0, 0);
	if (ret != 0)
	{
		printf("func IC_DBApi_ConnGet() err:%d\n", ret);
		return ret;
	}

	ret = IC_DBApi_BeginTran(handle);
	if (ret != 0)
	{
		printf("func IC_DBApi_BeginTran() err:%d\n", ret);
		goto END;
	}

	strcpy(mySql, "insert into dept(deptno, dname, loc) values(92, '92name姓名', '92loc城市')");

	//执行sql语句 2类错误 1类：执行sql语句失败  2：链接断开
	ret = IC_DBApi_ExecNSelSql(handle, mySql); //insert update
	if (ret != 0)
	{
		printf("func IC_DBApi_ExecNSelSql() err:%d\n", ret);
		goto END;
	}

	if (ret == 0)
	{
		IC_DBApi_Commit(handle);
	}
	else
	{
		IC_DBApi_Rollback(handle);
	}

END:
	//validFlag 1:不需要修复，0：需要断链修复
	if (ret == IC_DB_CONNECT_ERR)//把链接放到连接池
	{
		IC_DBApi_ConnFree(handle, 0);//需要断链修复
	}
	else
	{
		IC_DBApi_ConnFree(handle, 1);//不需要断链修复
	}

	IC_DBApi_PoolFree();

	printf("hello dbapi...\n");
	return 0;
}
*/